<?php //

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

/**
 * Controller photo
 *
 * @author luubk
 * @since 21-06-2012 - 02:03:21
 */
class Photo extends MY_Controller
{

    function __construct()
    {
        parent::__construct();
    }

    function index()
    {
        redirect(site_url());
    }

    function gate($url_encode)
    {                        
        $this->load->helper('file');                                 
        $url_ = urldecode(urldecode(urldecode($url_encode)));
                             
        $url = PHOTO_DIR .'/'. $url_;       

        if (file_exists($url))
        {
            header('filename=' . basename($url));
            $mime = get_mime_by_extension($url);
            header("Content-type: $mime");
            print file_get_contents($url);    
            
            echo 'ok';
        }    

    }

}

/** 
 * End file photo
 */
